Skip to content

Conversation

@Detoo
Copy link

@Detoo Detoo commented Oct 11, 2025

Primary goal is to keep changes minimum. The real feature changes are only in the following two files:

  • src/BaseAllocation.sol
  • src/MetaVesTController.sol

Changes are for (1) contracts size & stack-too-deep fixes, and (2) replacing capped minter interface with regular ERC20 tokens. Most logic are not new and directly restored from main branch, as shown and commented below.

The remaining changes are all scripts & tests.

Comment on lines +447 to +452
function validateTokenApprovalAndBalance(address tokenContract, uint256 total) internal view {
if (
IERC20M(tokenContract).allowance(authority, address(this)) < total ||
IERC20M(tokenContract).balanceOf(authority) < total
) revert MetaVesTController_AmountNotApprovedForTransferFrom();
}
Copy link
Author

@Detoo Detoo Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored from main:

function validateTokenApprovalAndBalance(address tokenContract, uint256 total) internal view {
if (
IERC20M(tokenContract).allowance(authority, address(this)) < total ||
IERC20M(tokenContract).balanceOf(authority) < total
) revert MetaVesTController_AmountNotApprovedForTransferFrom();
}

0,
0
);
safeTransferFrom(_allocation.tokenContract, authority, vestingAllocation, _total);
Copy link
Author

@Detoo Detoo Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored from main:

safeTransferFrom(_allocation.tokenContract, authority, vestingAllocation, _total);

Comment on lines +626 to +629
if (
IERC20M(_tokenContract).allowance(msg.sender, address(this)) < _milestone.milestoneAward ||
IERC20M(_tokenContract).balanceOf(msg.sender) < _milestone.milestoneAward
) revert MetaVesT_AmountNotApprovedForTransferFrom();
Copy link
Author

@Detoo Detoo Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored from main:

if (
IERC20M(_tokenContract).allowance(msg.sender, address(this)) < _milestone.milestoneAward ||
IERC20M(_tokenContract).balanceOf(msg.sender) < _milestone.milestoneAward
) revert MetaVesT_AmountNotApprovedForTransferFrom();

Comment on lines +271 to +272
//transfer the milestone award back to the authority, we check in the controller to ensure only uncompleted milestones can be removed
safeTransfer(allocation.tokenContract, getAuthority(), _milestoneAward);
Copy link
Author

@Detoo Detoo Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored from main:

//transfer the milestone award back to the authority, we check in the controller to ensure only uncompleted milestones can be removed
safeTransfer(allocation.tokenContract, getAuthority(), _milestoneAward);

Comment on lines +321 to +323
if (_amount > getAmountWithdrawable() || _amount > IERC20M(allocation.tokenContract).balanceOf(address(this))) revert MetaVesT_MoreThanAvailable();
tokensWithdrawn += _amount;
IController(controller).mint(recipient, _amount);
safeTransfer(allocation.tokenContract, recipient, _amount);
Copy link
Author

@Detoo Detoo Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored from main:

if (_amount > getAmountWithdrawable() || _amount > IERC20M(allocation.tokenContract).balanceOf(address(this))) revert MetaVesT_MoreThanAvailable();
tokensWithdrawn += _amount;
safeTransfer(allocation.tokenContract, msg.sender, _amount);
)

@Detoo Detoo marked this pull request as ready for review October 13, 2025 23:41
@Detoo Detoo requested a review from merisman October 13, 2025 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants